package cn.tedu.boot51.mapper;

import cn.tedu.boot51.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from user where username=#{username}")
    User selectByUsername(String username);

    @Select("select * from user")
    List<User> select();

    @Select("select * from user where id=#{id}")
    User selectById(int id);

    @Update("update user set username=#{username},password=#{password}," +
            "nick==#{nick},age==#{age} where id==#{id}")
    void update(User user);
}
